local s15__zhiba = fk.CreateSkill {
  name = "s15__zhiba",
  attached_skill_name = "s15__zhiba_active&",
}

Fk:loadTranslationTable {
  ["s15__zhiba"] = "制霸",
  [":s15__zhiba"] = "己方前锋的出牌阶段限一次，其可以与你拼点，若其没赢，你可以获得拼点的两张牌。",

  ["#s15__zhiba-ask"] = "%src 发起“制霸”拼点，是否拒绝？",
  ["s15__zhiba_yes"] = "进行“制霸”拼点",
  ["s15__zhiba_no"] = "拒绝“制霸”拼点",

  ["$s15__zhiba1"] = "我若怕你，非孙伯符也！",
  ["$s15__zhiba2"] = "是友是敌，一探便知。",
}

s15__zhiba:addAcquireEffect(function(self, player)
  local room = player.room
  for _, p in ipairs(room:getOtherPlayers(player, false)) do
    if p:isFriend(player) then
      room:handleAddLoseSkills(p, "s15__zhiba_active&", nil, false, true)
    else
      room:handleAddLoseSkills(p, "-s15__zhiba_active&", nil, false, true)
    end
  end
end)

s15__zhiba:addEffect(fk.AfterPropertyChange, {
  can_refresh = function(self, event, target, player, data)
    return target == player
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    if player:isFriend(player) and table.find(room.alive_players, function(p)
          return p ~= player and p:hasSkill(s15__zhiba.name, true)
        end) then
      room:handleAddLoseSkills(player, "s15__zhiba_active&", nil, false, true)
    else
      room:handleAddLoseSkills(player, "-s15__zhiba_active&", nil, false, true)
    end
  end,
})

return s15__zhiba
